# -*- coding: utf-8 -*-
from flasgger import Swagger
from flask import Flask, request, jsonify
import config
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
# 加载配置文件
app.config.from_object(config)
db = SQLAlchemy(app)

app.config['SWAGGER'] = {
    'title': 'Your API Title',
    'version': '1.0',
    'openapi': '3.0.2',  # 明确指定为Swagger 3.0.0版本
    'description': 'A description of your API'
}
swagger = Swagger(app)


@app.route('/api')
def api_index():
    if request.method == 'GET':
        return jsonify({'msg': 'hello world'})
    if request.method == 'POST':
        return jsonify({'msg': 'hello world'})

if __name__ == '__main__':
    app.run(debug=True)

